﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class temp_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //A a = new B();
        //Response.Write(a.Do());
        B b = new B();
        b.Age = 10;
        Response.Write(b.ShowAge());
    }

    public class A
    {
        public virtual string Do()
        {
            return "In Class A";
        }
    }

    public class B : A
    {
        private int age;

        public int Age
        {
            get { return age; }
            set { age = value; }
        }

        public new string Do()
        {
            return "In Class B";
        }

        public int ShowAge()
        {
            return age++;
        }

        public int ShowAge(B b)
        {
            b = new B();
            b.Age++;
            return b.ShowAge();
        }
    }
}